package network.course3;

public class ThreadTest {
    public static void main(String[] args) {
           ThreadTest test=new ThreadTest();
           MyThread thread1=test.new MyThread();
           thread1.setName("1");

        MyThread thread2=test.new MyThread();
        thread2.setName("2");
        thread1.start();
        thread2.start();
    }
    class MyThread extends Thread{

        @Override
        public void run() {
            System.out.println("线程"+Thread.currentThread().getName()+"进入睡眠状态");
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("线程 " + Thread.currentThread().getName() + " 睡眠结束");
        }
    }
}
